<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bai 2.1</title>
<style type="text/css">
<!--
.tieude {
	font-weight: bold;
	font-style: italic;
	font-size: 24px;
	background-color: #FCCD61;
	color: #960;
	text-align: center;
}
-->
</style>
</head>

<body>
<?php
	include 'class_phep_tinh.php';
	if(isset($_POST['so1'])&&isset($_POST['so2']))
	{
		$so1=$_POST['so1'];	
		$so2=$_POST['so2'];
		$rdValue=$_POST['rdgPhepTinh'];	
		$pheptinh="";
		$csPhepTinh=new Phep_Tinh();
		$csPhepTinh->so_thu_1=$so1;
		$csPhepTinh->so_thu_2=$so2;
		$kq;
		switch($rdValue)
		{
			case "cong":	$pheptinh="+";return $kq=$csPhepTinh->TinhCong();
			case "tru":	$pheptinh="-";return $kq=$csPhepTinh->TinhTru();
			case "nhan":	$pheptinh="*";return $kq=$csPhepTinh->TinhNhan();
			case "chia":	$pheptinh="/";
			if($so2!=0)return $kq=$csPhepTinh->TinhChia();break;			
		}
		echo $so1.$pheptinh.$so2."=".$kq;
	}
?>
<form id="form1" name="form1" method="post" action="Bai2_1.php">
  <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td colspan="2" class="tieude">PHÉP TÍNH</td>
    </tr>
    <tr>
      <td bgcolor="#CCCC99" style="font-weight: bold">Số thứ nhất: </td>
      <td bgcolor="#CCCC99"><input name="so1" type="text" id="so1" value="<?php echo $_POST['so1'];?>" /></td>
    </tr>
    <tr>
      <td bgcolor="#CCCC99" style="font-weight: bold">Số thứ hai: </td>
      <td bgcolor="#CCCC99"><input name="so2" type="text" id="so2" value="<?php echo $_POST['so2'];?>" /></td>
    </tr>
    <tr style="text-align: center">
      <td colspan="2" bgcolor="#CCCC99"><p>
        <label>
          <input name="rdgPhepTinh" type="radio" id="rdgPhepTinh_0" value="cong" checked="checked" />
          Cộng</label>
        <label>
          <input type="radio" name="rdgPhepTinh" value="tru" id="rdgPhepTinh_1" />
          Trừ</label>
        <label>
          <input type="radio" name="rdgPhepTinh" value="nhan" id="rdgPhepTinh_2" />
          Nhân</label>
        <label>
          <input type="radio" name="rdgPhepTinh" value="chia" id="rdgPhepTinh_3" />
          Chia</label>
        <input type="submit" name="button" id="button" value="Tính" />
        <br />
      </p></td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#CCCC99">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" class="tieude">KẾT QUẢ</td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#CC9999">&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>